package com.jprocms.module.cms.query;

import org.springframework.lang.Nullable;

public class WhereCondition {
    private String column;
    private String operator;
    @Nullable
    private Object value;

    public WhereCondition(String column, String operator, @Nullable Object value) {
        QueryUtils.validateField(column);
        this.column = column;
        this.operator = operator;
        this.value = value;
    }

    public String getColumn() {
        return column;
    }

    public void setColumn(String column) {
        this.column = column;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    @Nullable
    public Object getValue() {
        return value;
    }

    public void setValue(@Nullable Object value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "WhereCondition{" +
                "column='" + column + '\'' +
                ", operator='" + operator + '\'' +
                ", value=" + value +
                '}';
    }
}
